package SwordOffer;

public class Sword_Offer_10_I {

    public int fib(int n) {
        if (n < 2) {
            return n;
        }
        int pre1 = 0, pre2= 1;
        for (int i = 2; i <= n; i++) {
            int temp = (pre1 + pre2) % 1000000007;
            pre1= pre2;
            pre2 = temp;
        }
        return pre2;
    }

    public static void main(String[] args) {
        Sword_Offer_10_I model = new Sword_Offer_10_I();
        System.out.println(model.fib(5));
    }
}
